package com.bicon.bdata_service_search.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 描述:
 * test spring boot
 *
 * @author zhaoyu
 * @email zhaoyu@vv.cc
 * @create 2018-08-22 11:28
 */
@Controller
public class HelloWorldController {

    private Logger logger = LoggerFactory.getLogger(HelloWorldController.class);

    @Value("${userName}")
    private String userName;

    @Value("${bookTitle}")
    private String bookTitle;

    @RequestMapping("/hello")
    public String index() {
        logger.info("this is a test");
        return "Hello this is gradle make spring boot";
    }
//
//
    @RequestMapping("/welcome")
    public String index(ModelMap map) {
        // 加入一个属性，用来在模板中读取
        map.addAttribute("userName", userName);
        map.addAttribute("bookTitle", bookTitle);
        // return模板文件的名称，对应src/main/resources/templates/welcome.ftl
        return "welcome";
    }

}